% overview.tex

%%%%%%%%%%%%%%%%%%%%
\begin{frame}{}
  \begin{center}
    \red{\bf 输入:} 程序文本/字符串 $s$ \& \blue{\bf 词法单元 (token) 的规约}

    \vspace{0.50cm}
    \fig{width = 0.50\textwidth}{figs/lexer}

    \vspace{0.30cm}
    \red{\bf 输出:} 词法单元流
  \end{center}
\end{frame}
%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%
\begin{frame}{}
  \[
    \boxed{\text{token}: \langle \red{\text{token-class}}, \gray{\text{attribute-value}} \rangle}
  \]

  \fig{width = 0.80\textwidth}{figs/token-table}

  \pause
  \begin{center}
    \intkw/\ifkw \qquad 关键词 \\[8pt]
    \ws \qquad 空格、制表符、换行符  \\[8pt]
    \comment \qquad ``//'' 开头的一行注释或者``/* */'' 包围的多行注释
  \end{center}
  % \input{tables/token}
\end{frame}
%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%
\begin{frame}{}
  \fig{width = 0.50\textwidth}{figs/hello-world-c}

  \pause
  \vspace{0.20cm}
  \begin{center}
    \intkw \quad \ws \quad \red{\mainkw/\id} \quad \lp \quad \voidkw \quad \rp \quad \ws \\[6pt]
    \lb \quad \ws \\[6pt]
    \ws \quad \id \quad \lp \quad \literal \quad \rp \quad \semicolon \ws \\[6pt]
    \rb
  \end{center}

  \pause
  \vspace{0.20cm}
  \begin{center}
    本质上, 这就是一个\red{\bf 字符串(匹配/识别)算法}
  \end{center}
\end{frame}
%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%
\begin{frame}{}
  \begin{center}
    {\large 词法分析器的三种设计方法}
  \end{center}

  \begin{columns}
    \column{0.33\textwidth}
      \fig{width = 0.85\textwidth}{figs/by-hand}
      \begin{center}
        手写词法分析器
      \end{center}
    \column{0.34\textwidth}
      \fig{width = 0.80\textwidth}{figs/flex}
      \begin{center}
        词法分析器的生成器
      \end{center}
    \column{0.33\textwidth}
      \fig{width = 0.85\textwidth}{figs/dfa-lexer}
      \begin{center}
        自动化词法分析器
      \end{center}
  \end{columns}

  \vspace{0.30cm}
  \begin{center}
    生产环境下的编译器(如 gcc)通常选择{\bf 手写词法分析器}
  \end{center}
\end{frame}
%%%%%%%%%%%%%%%%%%%%